package com.applink.sell_proof;

import android.os.Bundle;
import android.widget.CompoundButton;

import com.applink.sell_proof.fragment.adapter.BaseFragmentPagerAdapter;
import com.applink.sell_proof.fragment.adapter.RewardFragmentPagerAdapter;
import com.applink.sell_proof.util.Utility;

public class RewardActivity extends BasePagerActivity {
	
	protected BaseFragmentPagerAdapter mFragmentAdapter;
	
	
	
	@Override
	protected void onCreate(Bundle saveInstanceState) {
		super.onCreate(saveInstanceState);
		setTitle(getString(R.string.reward));
	}
	
	@Override
	protected void onResume() {
		super.onResume();
		int checkState = Utility.checkTimeValidation();
		switch (checkState) {
		case 0:
			Utility.showAlertDialogLogout(this, android.R.drawable.ic_dialog_alert, Utility.messageServerTimeOut, Utility.titleServerTimeOut, RewardActivity.this);
			break;
		case 1:
			Utility.showAlertDialogLogout(this, android.R.drawable.ic_dialog_alert, Utility.messageLocalTimeOut, Utility.titleLocalTimeOut, RewardActivity.this);
			break;

		default:
			break;
		}
	}
	
	@Override
    protected BaseFragmentPagerAdapter getFragmentPagerAdapter()
    {
		if(mFragmentAdapter == null) {
			mFragmentAdapter = new RewardFragmentPagerAdapter(getSupportFragmentManager());
		}
		return mFragmentAdapter;
    }

	@Override
    protected int getDefaultPagerIndex()
    {
	    return 0;
    }
	
	@Override
	public void setSelectedTab() {
		((CompoundButton)findViewById(R.id.reward_tab)).setChecked(true);
	}
	
	@Override
	public int getActivityIndex() {
		return BasePagerActivity.REWARD_ACTIVITY;
	}
}
